package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.policy.MySpider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PolicyDocumentsMapper;
import com.ruoyi.system.domain.PolicyDocuments;
import com.ruoyi.system.service.IPolicyDocumentsService;
import us.codecraft.webmagic.Spider;

/**
 * 文件Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-01
 */
@Service
public class PolicyDocumentsServiceImpl extends ServiceImpl<PolicyDocumentsMapper, PolicyDocuments> implements IPolicyDocumentsService {
    @Autowired
    private PolicyDocumentsMapper policyDocumentsMapper;

    @Autowired
    MySpider mySpider;

    /**
     * 查询文件
     *
     * @param id 文件主键
     * @return 文件
     */
    @Override
    public PolicyDocuments selectPolicyDocumentsById(Long id) {
        return policyDocumentsMapper.selectPolicyDocumentsById(id);
    }

    /**
     * 查询文件列表
     *
     * @param policyDocuments 文件
     * @return 文件
     */
    @Override
    public List<PolicyDocuments> selectPolicyDocumentsList(PolicyDocuments policyDocuments) {
        return policyDocumentsMapper.selectPolicyDocumentsList(policyDocuments);
    }

    /**
     * 新增文件
     *
     * @param policyDocuments 文件
     * @return 结果
     */
    @Override
    public int insertPolicyDocuments(PolicyDocuments policyDocuments) {
        return policyDocumentsMapper.insertPolicyDocuments(policyDocuments);
    }

    /**
     * 修改文件
     *
     * @param policyDocuments 文件
     * @return 结果
     */
    @Override
    public int updatePolicyDocuments(PolicyDocuments policyDocuments) {
        return policyDocumentsMapper.updatePolicyDocuments(policyDocuments);
    }

    /**
     * 批量删除文件
     *
     * @param ids 需要删除的文件主键
     * @return 结果
     */
    @Override
    public int deletePolicyDocumentsByIds(Long[] ids) {
        return policyDocumentsMapper.deletePolicyDocumentsByIds(ids);
    }

    /**
     * 删除文件信息
     *
     * @param id 文件主键
     * @return 结果
     */
    @Override
    public int deletePolicyDocumentsById(Long id) {
        return policyDocumentsMapper.deletePolicyDocumentsById(id);
    }

    /**
     * 获取数据
     */
    @Override
    public void queryPolicy() {
        mySpider.queryPolicy();
    }


}
